import { getCategoryList } from '../../../services/good/fetchCategoryList';
import { get } from '../../../utils/request';

Page({
  data: {
    list: [],
  },
  async init() {
    wx.request({
      url: `http://8.130.99.108:8090/api/getDoctors`, //仅为示例，并非真实的接口地址
      data: {},
      header: {
        'content-type': 'application/json', // 默认值
      },
      method: 'GET',
      success: (res) => {
        if (res.data.message == '服务运行成功') {
          const arr = [];
          res.data.data.map((item) => {
            arr.push({
              children: [],
              name: item.departmentName,
            });
          });
          this.setData({
            list: [...arr],
          });
        }
      },
      fail: (error) => {
        console.log(error);
      },
    });
  },

  onShow() {
    this.getTabBar().init();
  },
  onChange() {
    wx.navigateTo({
      url: '/pages/goods/list/index',
    });
  },
  onLoad() {
    this.init(true);
  },
});
